package com.hub.utils.enums;

import lombok.Getter;

/**
 * @author hub
 * @version 1.0
 * @date 2020/5/21 13:31
 * @description:
 */
@Getter
public enum FileTypeEnum {

    Picture(1,"图片"),
    Maintenance(2,"维保手册"),
    Knowledge(3,"知识库");

    private int code;
    private String description;

    FileTypeEnum(int code, String desc) {
        this.code = code;
        this.description = desc;
    }

    /**
     * 获取枚举值的描述
     * @param index
     * @return
     */
    public static String getDescription(int index) {
        for(FileTypeEnum uge : FileTypeEnum.values()){
            if(uge.getCode() == index){
                return uge.description;
            }
        }
        return "未知编码";
    }

    public static FileTypeEnum[] a=FileTypeEnum.values();
    public static FileTypeEnum valueOf(int i) {
        return a[i];
    }
}
